package ioperations;

import book.BookList;

import java.util.Scanner;

public class FindOperation implements IOPeration{
    public void work(BookList bookList){
        System.out.println("查找图书...");
        System.out.println("输入你想找的图书：");
        Scanner scanner=new Scanner(System.in);
        String name= scanner.nextLine();
        int currentSize= bookList.getUsedSize();
        for (int i = 0; i <currentSize; i++) {
           if(name.equals(bookList.getBooks(i).getName())){
               System.out.println("找到了");
               System.out.println(bookList.getBooks(i));
               return;
           }
        }
        System.out.println("没找到你想要的图书");
    }
}
